Repository navigation
fix(model): default NVIDIA NIM main loop model - #1928
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 33 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughNVIDIA NIM model resolution now uses the configured model or route default before its hardcoded fallback. Unknown model costs now use the explicit unknown-model estimate instead of inheriting the configured main-loop model’s pricing tier. ChangesModel behavior corrections
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/model/model.openai-shim-providers.test.ts`:
- Around line 323-331: Replace the tautological expectation in the NVIDIA NIM
fallback test with a stable, concrete expected NVIDIA model identifier (or
explicitly assert it differs from the Claude default); do not call
getRouteDefaultModel('nvidia-nim') in the expectation. Keep the setup using
NVIDIA_NIM and CLAUDE_CODE_USE_OPENAI and verify
getDefaultMainLoopModelSetting() returns the intended NIM model id.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: fe00db77-7b83-430a-bb17-1805990a2054
📒 Files selected for processing (4)
src/utils/model/model.openai-shim-providers.test.tssrc/utils/model/model.tssrc/utils/modelCost.modelGate.test.tssrc/utils/modelCost.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: smoke-and-tests (24.11.x)
- GitHub Check: smoke-and-tests (22)
- GitHub Check: typecheck
- GitHub Check: CodeRabbit / Review
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
TypeScript code in this repository must use strict mode and ESM imports.
Files:
src/utils/modelCost.modelGate.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/modelCost.tssrc/utils/model/model.ts
**
⚙️ CodeRabbit configuration file
**: # AGENTS.md - AI Agent Coding GuideThis guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.
Project Snapshot
OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.
The installed CLI runs on Node.js
>=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.Work Style
- Keep changes focused on one problem.
- Prefer existing patterns in the file or nearby module.
- Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
- Add or update tests when behavior changes.
- Update docs when setup, commands, provider behavior, or user-facing behavior changes.
- For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.
Stack And Conventions
- TypeScript with strict mode and ESM imports.
- React + Ink for terminal UI.
- Bun lockfile and Bun scripts for development workflows.
- Node runtime for the built CLI.
Common libraries and patterns:
chalkfor terminal color.commanderfor CLI argument parsing.execafor child processes.- Existing service, provider, settings, permission, and UI patterns over new abstractions.
Repository Map
src/commands/- slash and CLI command implementations.src/components/- React/Ink UI components.src/services/- API, MCP, OAuth, wiki, voice, and other service integrations.src/tools/- tool implementations.src/utils/- shared utilities.src/integrations/- provider and model integration metadata.src/entrypoints/- CLI, MCP, SDK, and generated public types.src/tasks/- local, remote, workflow, and monitor tas...
Files:
src/utils/modelCost.modelGate.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/modelCost.tssrc/utils/model/model.ts
**/*
⚙️ CodeRabbit configuration file
**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.
Files:
src/utils/modelCost.modelGate.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/modelCost.tssrc/utils/model/model.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}
⚙️ CodeRabbit configuration file
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.
Files:
src/utils/modelCost.modelGate.test.tssrc/utils/model/model.openai-shim-providers.test.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}
⚙️ CodeRabbit configuration file
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.
Files:
src/utils/model/model.openai-shim-providers.test.tssrc/utils/model/model.ts
🔇 Additional comments (4)
src/utils/model/model.ts (1)
33-33: NVIDIA NIM fallback chain looks correct.Env → route descriptor default → hardcoded fallback matches the pattern used elsewhere (e.g. minimax) and directly addresses the 404 fallback-to-Claude bug.
getRouteDefaultModelis a pure, synchronous lookup with no side effects, so no new network reach or hidden default expansion is introduced — the added fallback is intentional and documented in the comment.Also applies to: 392-400
src/utils/modelCost.ts (1)
165-168: Fix correctly prevents unknown models from inheriting unrelated pricing.Unconditionally returning
DEFAULT_UNKNOWN_MODEL_COSTfor unmapped models removes the previous unintended coupling to the configured main-loop model's tier, and the updated comment documents the contract clearly.Also applies to: 183-184
src/utils/modelCost.modelGate.test.ts (1)
25-46: Good regression test for the pricing fix.Mocking
getDefaultMainLoopModelSettingto return a priced model (claude-haiku-4-5) while asserting the unknown model still getsCOST_TIER_5_25directly proves the bug is fixed and guards against regression.src/utils/model/model.openai-shim-providers.test.ts (1)
310-321: 🩺 Stability & AvailabilityNo action needed for env cleanup here. The shared
beforeEach/afterEachhooks already clearNVIDIA_NIM,CLAUDE_CODE_USE_OPENAI, andOPENAI_MODEL, so these values don’t leak across tests.> Likely an incorrect or invalid review comment.
Summary
Fixes #1925 and addresses the incorrect unknown-model pricing fallback in #1924.
OPENAI_MODELfor NVIDIA NIM main-loop defaults.OPENAI_MODELis unset, avoiding an invalid Claude model on the NIM endpoint.Pricing behavior for unpriced NIM models
This PR does not claim an exact NVIDIA NIM price where the application has no
authoritative per-model rate. An unpriced NIM model continues to use the
application's generic unknown-model estimate: $5 per million input tokens
and $25 per million output tokens. The session output explicitly warns:
Why it is unknown: NVIDIA's model endpoint returns model IDs, but not
input/output token prices. NVIDIA's public pricing documentation describes
free developer access and GPU-based production licensing, not a per-model
token-price API. LiteLLM's current catalog also has no NIM chat-model price
entries. OpenClaude therefore has no source for a verified NIM token price.
The fix is that this estimate is no longer silently replaced by the price of
whichever model the user configured as their default.
Validation
bun test src/utils/model/model.openai-shim-providers.test.tsbun test src/utils/modelCost.modelGate.test.tsbun run typecheckbun run check(build, smoke, and dead-code stages passed; the serial full-test stage has pre-existing unrelated failures, reproduced on unchangedmain)Limitation
The complete serial test suite currently has baseline failures outside this change (discovery cache, shell-governance, and xAI OAuth suites). The focused provider suite and TypeScript check pass.
Summary by CodeRabbit